package admin

import (
	"fmt"
	"gitee.com/yangguoliang001/go-gin-vue3/pkg/response"
	"github.com/duke-git/lancet/v2/convertor"
	"github.com/gin-gonic/gin"
)

// Logout 管理员登出
// @Summary 管理员登出
// @Description 管理员登出
// @Tags API.admin
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} response.TResponse{data=vo.LogoutVO}
// @Failure 400 {object} response.TResponse{data=interface{}}
// @Router /api/logout [post]
func (ac *adminController) Logout(c *gin.Context) {
	//var logoutReq QO.LogoutQO
	//if err := c.ShouldBind(&logoutReq); err != nil {
	//	response.Fail(c, code.ParamBindError, code.Text(code.ParamBindError), gin.H{"realErr": err})
	//	return
	//}

	res, err := ac.adminService.Logout(c)
	fmt.Println("******Logout******", res)
	resMap, _ := convertor.StructToMap(res)
	if err == nil {
		response.Success(c, "退出登录成功", resMap)
	}
}
